package config

import (
	"gopkg.in/yaml.v2"
	"log"
	"os"
	"ylb/entity"
)

func GetEmailConnectionConfig() (entity.EmailConnection, error) {
	m := entity.EmailConnection{}
	open, err := os.Open("./config/email.yaml")
	defer open.Close()
	if err != nil {
		log.Println("[读取email.yaml]失败...")
		return m, err
	}
	decoder := yaml.NewDecoder(open)

	err = decoder.Decode(&m)
	if err != nil {
		log.Println("[解析email.yaml]失败...")
		return m, err
	}

	return m, nil

}
